// service 统一出口
import CService from './request'
import localCache from '@/utils/cache'
const CRuquest = new CService({
  // baseURL: process.env.VUE_APP_BASE_URL,
  // 测试代理环境
  baseURL: '/api',
  timeout: 10000,
  interceptors: {
    requestInterceptor: (config) => {
      const token = localCache.getLocalCache('token')
      if (token) {
        if (config && config.headers) {
          config.headers.Authorization = `Bearer ${token}`
        }
      }
      return config
    }
    // requestInterceptorCatch: (err) => {
    //   return err
    // },
    // responseInterceptor: (res) => {
    //   return res.data
    // },
    // responseInterceptorCatch: (err) => {
    //   return err
    // }
  }
})

export default CRuquest
